import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/hot',
    name: 'hot',
    component: () => import('@/views/hotPages.vue')
  },
  {
    path: '/editor',
    name: 'editor',
    component: () => import('@/views/richText.vue')
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('@/views/emoji.vue')
  },
  {
    path: '/post/:artId',
    name: 'post',
    component: () => import('@/views/post.vue')
  }
]

const router = new VueRouter({
  routes
})
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

export default router
